#e
#Title[\zu̊فv]
#Text[]
#ScriptVersion[2]
script_enemy_main
{
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(1);
		SetDamageRate(0,0);
		SetMovePosition02(cx,cy,60);
		SetTimer(93);
		SetGraphicRect(1,1,64,64);
		SetDurableSpellCard;
		LoadGraphic(imgExRumia);
		SetTexture(imgExRumia);	
		CutIn(YOUMU,"\zu̊فv",0,0,0,0,0);//XyJ[h\
		shottask;
	}
	@MainLoop
	{
		yield;
	}
	@Finalize
	{
	}
	@DrawLoop
	{
		//Ex[~A`
		SetGraphicRect(64,64,127,127);
		SetAlpha(32);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
	}
	task shottask
	{
		wait(120);
		CreateEnemyFromScript("family",GetX,GetY,0,0,0);
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}
script_enemy family
{
	let angle=0;
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetLife(1);
		SetDamageRate(0,0);
		SetInvincibility(60);
		shottask;
		shottask2;
		movetask;
	}
	@MainLoop
	{
		yield;
	}
	@Finalize
	{
	}
	@DrawLoop
	{
	}
	task shottask
	{
		let s=0;
		loop
		{
			wait(3);
			shot2(s,120,0,30,1);
			if(GetTimer<=70)
			{
				shot2(s,120,180,30,1);
				shot2(s,120,90,30,1);
				shot2(s,120,-90,30,1);
			}
			if(GetTimer<=55)
			{
				shot2(s,120,rand(-90,90),126,1);
			}
		}
	}
	task shottask2
	{
		let s=0;
		loop
		{
			wait(12);
			if(GetTimer<=30)
			{
				shot2(s,120,0,38,0.4);
			}
			if(GetTimer<=15)
			{
				shot2(s,120,0,102,4);
			}
		}
	}	
	task movetask
	{
		let angle=atan2(GetPlayerY-GetEnemyY,GetPlayerX-GetEnemyX)-90;
		let r=5;
		loop
		{
			yield;
			if(GetTimer<=86)
			{
				SetMovePosition02(GetPlayerX,GetPlayerY,30);
			}
			else
			{
				SetX(GetEnemyX+r*cos(angle));
				SetY(GetEnemyY+r*sin(angle));
			}
			if(GetTimer==71)
			{
				Concentration01(60);
				wait(60);
			}
			if(GetTimer==56)
			{
				Concentration01(60);
				wait(60);
			}
			if(GetTimer==31)
			{
				Concentration01(60);
				wait(60);
			}
			if(GetTimer==16)
			{
				Concentration01(60);
				wait(60);
			}
			angle+=3;
			r+=0.5;
		}
	}
	function shot(let shotid,let shott,let angle,let tipe,let sp)
	{
		CreateShotA(shotid,GetX,GetY,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(shotid,0,sp,angle,0,0,2,tipe);
		FireShot(shotid);
	}
	function shot2(let shotid,let shott,let angle,let tipe,let sp)
	{
		CreateShotA(shotid,GetX,GetY,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(shotid,0,0,GetAngleToPlayer,0,0,2,tipe);
		SetShotDirectionType(PLAYER);
		SetShotDataA(shotid,shott,sp,angle,0,0,2,tipe);
		FireShot(shotid);
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}